package com.example.springretry.controller;

import com.example.springretry.service.PayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jimao.zou
 * @date 9/27/2018 2:17 PM
 * @description: TODO
 */
@Slf4j
@RestController
public class RetryController {

    @Autowired
    private PayService payService;

    @GetMapping("/createOrder")
    public String createOrder(@RequestParam int num) throws Exception{
        return payService.retryByTemplate(num == 0 ? 1: num);
    }

}
